﻿using System.ComponentModel;
using System.Configuration;
using System.Diagnostics;

namespace LabColorPicker.Properties {

    public sealed partial class Settings {

        public Settings( ) {
            SettingChanging += SettingChangingEventHandler;
            PropertyChanged += PropertyChangedEventHandler;
            SettingsLoaded += SettingsLoadedEventHandler;
            SettingsSaving += SettingsSavingEventHandler;
        }

        // The SettingChanging event is raised before a setting's value is changed.
        private void SettingChangingEventHandler( object sender, SettingChangingEventArgs ev ) {
            // Add code to handle the SettingChanging event here.
            Debug.Print( "%%% Settings.SettingChanging: class='{0}' key='{1}' name='{2}' new value='{3}'", ev.SettingClass, ev.SettingKey, ev.SettingName, ev.NewValue );
        }

        // The PropertyChanged event is raised after a setting's value is changed.
        private void PropertyChangedEventHandler( object sender, PropertyChangedEventArgs ev ) {
            // Add code to handle the PropertyChanged event here.
            Debug.Print( "%%% Settings.PropertyChanged: name='{0}'", ev.PropertyName );
        }

        // The SettingsLoaded event is raised after the setting values are loaded.
        private void SettingsLoadedEventHandler( object sender, SettingsLoadedEventArgs ev ) {
            // Add code to handle the SettingsLoaded event here.
            Debug.Print( "%%% Settings.SettingsLoaded: provider: application name='{0}', name='{1}'", ev.Provider.ApplicationName, ev.Provider.Name );
        }

        // The SettingsSaving event is raised before the setting values are saved.
        private void SettingsSavingEventHandler( object sender, CancelEventArgs ev ) {
            // Add code to handle the SettingsSaving event here.
            Debug.Print( "%%% Settings.SettingsSaving" );
        }

    }

}
